package com.example.aop.aspect;


import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.stereotype.Component;

@Slf4j
@Aspect
@Component
public class MyAspectDemo {

    @Around("@annotation(org.springframework.web.bind.annotation.RequestMapping)")
    public Object doAround(ProceedingJoinPoint proceedingJoinPoint) {
        log.info("do around before");
        Object o = null;
        try {
            o = proceedingJoinPoint.proceed();
        } catch (Throwable e) {
            log.error("发生异常：" , e);
        }
        log.info("do around after");
        return o;
    }
}
